class StringFormat {
public:
    string formatString(string A, int n, vector<char> arg, int m) {
        int index=0;
        string ret;
        for(int i=0;i<n;)
        {
            if(A[i]=='%')
            {
                ret.push_back(arg[index++]);
                i+=2;
            }
            else
            {
                ret.push_back(A[i]);
                i++;
            }
        }
        while(index<m)
        {
            ret.push_back(arg[index++]);
        }
        return ret;
    }
};